package com.game.model;

import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Data
public class GameRoom {
    private String id;
    private List<Player> players;
    private GameStatus status;
    private List<Card> deck;
    private int currentRound;
    private int maxPlayers;

    public enum GameStatus {
        WAITING,
        PLAYING,
        FINISHED
    }

    public GameRoom() {
        this.id = UUID.randomUUID().toString();
        this.players = new ArrayList<>();
        this.status = GameStatus.WAITING;
        this.deck = new ArrayList<>();
        this.currentRound = 0;
        this.maxPlayers = 4;
    }

    public boolean isFull() {
        return players.size() >= maxPlayers;
    }

    public void addPlayer(Player player) {
        if (!isFull()) {
            players.add(player);
        }
    }

    public void removePlayer(String playerId) {
        players.removeIf(player -> player.getId().equals(playerId));
    }

    public void initializeDeck() {
        deck.clear();
        for (Card.Suit suit : Card.Suit.values()) {
            for (Card.Rank rank : Card.Rank.values()) {
                deck.add(new Card(suit, rank));
            }
        }
    }
} 